home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / var / lib / python-support / python2.6 / dbus / gobject_service.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  2.6 KB  |  55 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. '''Support code for implementing D-Bus services via GObjects.'''
  5. import gobject
  6. import dbus.service as dbus
  7.  
  8. class ExportedGObjectType(gobject.GObjectMeta, dbus.service.InterfaceType):
  9.     '''A metaclass which inherits from both GObjectMeta and
  10.     `dbus.service.InterfaceType`. Used as the metaclass for `ExportedGObject`.
  11.     '''
  12.     
  13.     def __init__(cls, name, bases, dct):
  14.         gobject.GObjectMeta.__init__(cls, name, bases, dct)
  15.         dbus.service.InterfaceType.__init__(cls, name, bases, dct)
  16.  
  17.  
  18.  
  19. class ExportedGObject(gobject.GObject, dbus.service.Object):
  20.     """A GObject which is exported on the D-Bus.
  21.  
  22.     Because GObject and `dbus.service.Object` both have custom metaclasses,
  23.     the naive approach using simple multiple inheritance won't work. This
  24.     class has `ExportedGObjectType` as its metaclass, which is sufficient
  25.     to make it work correctly.
  26.     """
  27.     __metaclass__ = ExportedGObjectType
  28.     
  29.     def __init__(self, conn = None, object_path = None, **kwargs):
  30.         '''Initialize an exported GObject.
  31.  
  32.         :Parameters:
  33.             `conn` : dbus.connection.Connection
  34.                 The D-Bus connection or bus
  35.             `object_path` : str
  36.                 The object path at which to register this object.
  37.         :Keywords:
  38.             `bus_name` : dbus.service.BusName
  39.                 A bus name to be held on behalf of this object, or None.
  40.             `gobject_properties` : dict
  41.                 GObject properties to be set on the constructed object.
  42.  
  43.                 Any unrecognised keyword arguments will also be interpreted
  44.                 as GObject properties.
  45.             '''
  46.         bus_name = kwargs.pop('bus_name', None)
  47.         gobject_properties = kwargs.pop('gobject_properties', None)
  48.         if gobject_properties is not None:
  49.             kwargs.update(gobject_properties)
  50.         
  51.         gobject.GObject.__init__(self, **kwargs)
  52.         dbus.service.Object.__init__(self, conn = conn, object_path = object_path, bus_name = bus_name)
  53.  
  54.  
  55.